3.527 \(\int \cos (c+d x) (a+b \tan (c+d x))^2 \, dx\)

Optimal. Leaf size=47 \[ \frac {\left (a^2-b^2\right ) \sin (c+d x)}{d}-\frac {2 a b \cos (c+d x)}{d}+\frac {b^2 \tanh ^{-1}(\sin (c+d x))}{d} \]

[Out]

b^2*arctanh(sin(d*x+c))/d-2*a*b*cos(d*x+c)/d+(a^2-b^2)*sin(d*x+c)/d

________________________________________________________________________________________

Rubi [A]  time = 0.03, antiderivative size = 47, normalized size of antiderivative = 1.00, number of steps used = 1, number of rules used = 1, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.053, Rules used = {3507} \[ \frac {\left (a^2-b^2\right ) \sin (c+d x)}{d}-\frac {2 a b \cos (c+d x)}{d}+\frac {b^2 \tanh ^{-1}(\sin (c+d x))}{d} \]

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]*(a + b*Tan[c + d*x])^2,x]

[Out]

(b^2*ArcTanh[Sin[c + d*x]])/d - (2*a*b*Cos[c + d*x])/d + ((a^2 - b^2)*Sin[c + d*x])/d

Rule 3507

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^2/sec[(e_.) + (f_.)*(x_)], x_Symbol] :> Simp[(b^2*ArcTanh[Sin[e + f
*x]])/f, x] + (-Simp[(2*a*b*Cos[e + f*x])/f, x] + Simp[((a^2 - b^2)*Sin[e + f*x])/f, x]) /; FreeQ[{a, b, e, f}
, x] && NeQ[a^2 + b^2, 0]

Rubi steps

\begin {align*} \int \cos (c+d x) (a+b \tan (c+d x))^2 \, dx &=\frac {b^2 \tanh ^{-1}(\sin (c+d x))}{d}-\frac {2 a b \cos (c+d x)}{d}+\frac {\left (a^2-b^2\right ) \sin (c+d x)}{d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.14, size = 84, normalized size = 1.79 \[ \frac {\left (a^2-b^2\right ) \sin (c+d x)-2 a b \cos (c+d x)+b^2 \left (\log \left (\sin \left (\frac {1}{2} (c+d x)\right )+\cos \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )}{d} \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]*(a + b*Tan[c + d*x])^2,x]

[Out]

(-2*a*b*Cos[c + d*x] + b^2*(-Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] + Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2
]]) + (a^2 - b^2)*Sin[c + d*x])/d

________________________________________________________________________________________

fricas [A]  time = 0.75, size = 62, normalized size = 1.32 \[ -\frac {4 \, a b \cos \left (d x + c\right ) - b^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) + b^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}{2 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

-1/2*(4*a*b*cos(d*x + c) - b^2*log(sin(d*x + c) + 1) + b^2*log(-sin(d*x + c) + 1) - 2*(a^2 - b^2)*sin(d*x + c)
)/d

________________________________________________________________________________________

giac [B]  time = 1.03, size = 1316, normalized size = 28.00 \[ \text {result too large to display} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c))^2,x, algorithm="giac")

[Out]

-1/2*(b^2*log(2*(tan(1/2*d*x)^4*tan(1/2*c)^2 + 2*tan(1/2*d*x)^4*tan(1/2*c) + 2*tan(1/2*d*x)^3*tan(1/2*c)^2 + t
an(1/2*d*x)^4 + 2*tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^3 + 2*tan(1/2*d*x)*tan(1/2*c)^2 + 2*tan(1/2*d*x
)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*c)^2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+ tan(1/2*d*x)^4 +
 2*tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^3 - 2*tan(1/2*d*x)*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2 + tan(1/2*c
)^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) + 1)/(tan(1/2*c)^2 + 1)) - 4*a^2*tan(1/2*d*x) + 4*b^2*tan(1/2*d*x) - 4*a^2
*tan(1/2*c) + 4*b^2*tan(1/2*c) + 4*a*b)/(d*tan(1/2*d*x)^2*tan(1/2*c)^2 + d*tan(1/2*d*x)^2 + d*tan(1/2*c)^2 + d
)

________________________________________________________________________________________

maple [A]  time = 0.27, size = 63, normalized size = 1.34 \[ \frac {a^{2} \sin \left (d x +c \right )}{d}-\frac {b^{2} \sin \left (d x +c \right )}{d}-\frac {2 a b \cos \left (d x +c \right )}{d}+\frac {b^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)*(a+b*tan(d*x+c))^2,x)

[Out]

a^2*sin(d*x+c)/d-b^2*sin(d*x+c)/d-2*a*b*cos(d*x+c)/d+1/d*b^2*ln(sec(d*x+c)+tan(d*x+c))

________________________________________________________________________________________

maxima [A]  time = 0.33, size = 60, normalized size = 1.28 \[ \frac {b^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right ) - 2 \, \sin \left (d x + c\right )\right )} - 4 \, a b \cos \left (d x + c\right ) + 2 \, a^{2} \sin \left (d x + c\right )}{2 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

1/2*(b^2*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1) - 2*sin(d*x + c)) - 4*a*b*cos(d*x + c) + 2*a^2*sin(d*x
 + c))/d

________________________________________________________________________________________

mupad [B]  time = 3.89, size = 66, normalized size = 1.40 \[ \frac {2\,b^2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d}-\frac {4\,a\,b-\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (2\,a^2-2\,b^2\right )}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(c + d*x)*(a + b*tan(c + d*x))^2,x)

[Out]

(2*b^2*atanh(tan(c/2 + (d*x)/2)))/d - (4*a*b - tan(c/2 + (d*x)/2)*(2*a^2 - 2*b^2))/(d*(tan(c/2 + (d*x)/2)^2 +
1))

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \left (a + b \tan {\left (c + d x \right )}\right )^{2} \cos {\left (c + d x \right )}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c))**2,x)

[Out]

Integral((a + b*tan(c + d*x))**2*cos(c + d*x), x)

________________________________________________________________________________________